#include<stdio.h>
#define FILEINP "LINES.INP"
#define FILEOUT "LINES.OUT"
int dir_col[]={0,1,0,0,-1};
int dir_row[]={0,0,1,-1,0};
int n,m,c[1001][1001]={0};
int start_row,start_collum,end_row,end_collum;
long queue_row[10000001]={0},queue_collum[10000001]={0},first=0,last=0;
int result=0;
int trace[1001][1001]={0};
char ch[]={'0','E','S','N','W'};
void input(){
    FILE *fp=fopen(FILEINP,"r");
    fscanf(fp,"%d%d%d%d%d%d",&n,&m,&start_row,&start_collum,&end_row,&end_collum);
    int a,b;
    for(a=0;a<=n+1;a++)c[0][a]=c[m+1][a]=1;
    for(b=0;b<=m+1;b++)c[b][0]=c[b][n+1]=1;
    while(!feof(fp)){
        fscanf(fp,"%d%d",&a,&b);
        c[a][b]=1;
    }
    fclose(fp);
}
void bfs(){
    int row,collum,i;
    //Push x,y
    first=1;last=1;
    queue_row[first]=start_row;
    queue_collum[first]=start_collum;
    c[start_row][start_collum]=1;
    do{
        row=queue_row[last];
        collum=queue_collum[last];
        last++;
        for(i=1;i<=4;i++){ 
            //printf("(%d,%d)->(%d,%d)(%d)\n",row,collum,row+diry[i],collum+dir_col[i],c[row+diry[i]][collum+dirx[i]] );
            if(c[row+dir_row[i]][collum+dir_col[i]]==0){
                c[row+dir_row[i]][collum+dir_col[i]]=1;
                //Dua vo queue
                first++;
                queue_row[first]=row+dir_row[i];
                queue_collum[first]=collum+dir_col[i];
                
                //Dat trace
                trace[row+dir_row[i]][collum+dir_col[i]]=i;
                
                if(row+dir_row[i]==end_row && collum+dir_col[i]==end_collum){
                    result=1;
                    return;
                }
            }
        }
    }while(first>=last);
    result=0;
}

void output(){
    char out[10000]={0};
    int i=0,row=end_row,collum=end_collum,r,c;
    FILE *fp=fopen(FILEOUT,"w");
    if(result){
        while(row!=start_row || collum!=start_collum){
            i++;
            out[i]=ch[trace[row][collum]];
            r=row-dir_row[trace[row][collum]];
            c=collum-dir_col[trace[row][collum]];
            row=r;
            collum=c;
        }
        fprintf(fp,"1\n");
        while(i>0){
            fprintf(fp,"%c",out[i]);
            i--;
        } 
    }else{
        fprintf(fp,"0");
    }
    fclose(fp);
}
int main(){
    input();
    bfs();
    output();
    return 0;
}
                
                
    

